package reflect;

import java.lang.reflect.Method;
import java.util.Scanner;

public class Test2 {
    public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException {
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入类名:");
        String className = scan.nextLine();

        Class cls = Class.forName(className);
        if(cls.isAnnotationPresent(AutoRunClass.class)){
            System.out.println("实例化:"+className);
            Object obj = cls.newInstance();
            System.out.println(obj);
        }else{
            System.out.println(className+"没有被标注");
        }
    }
}
